<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>ATM机</title>
    <script>
        //    请输入您要的操作
        //    1.存钱
        //    2.取钱
        //    3.显示余额
        //    4.退出
        var sum = 100;
        for (var i = 0; i <= 99999; i++) {
            var caozuo = prompt('请输入您需要的操作\n1.存钱\n2.取钱\n3.查询余额\n4.退出系统');
            if (caozuo == '1') {
                var cunqian = prompt('请输入您需要存入的金额');
                sum = sum + cunqian * 1;
                alert('您的余额为' + sum + '元');
            } else if (caozuo == '2') {
                var quqian = prompt('请输入您需要取出的金额');
                sum = sum - quqian;
                if (sum >= 0) {
                    alert('您的余额为' + sum + '元');
                } else {
                    alert('对不起，您的余额为负');
                    continue;
                }
            } else if (caozuo == '3') {
                alert('您的余额为' + sum + '元');
            } else if (caozuo == '4') {
                alert('您已退出系统');
                break;
            } else {
                alert('您的操作有误');
                continue;
            }
        }


    </script>
</head>

<body>

</body>

</html>